﻿@{
    ViewBag.Title = "Degustaciones";
    Layout = "~/Views/Shared/_Layout.cshtml";
 
}
@using Helena.Areas.Degustaciones.Models
@model IEnumerable<DegustacionView>           
@using Telerik.Web.Mvc.UI
@Html.Telerik().ScriptRegistrar().Globalization(true)

<style type="text/css">
    .t-window
    {
        width: 600px;
        margin: 0px auto;
    }
</style>

<div class="block big" style="position: relative">
    <!-- Block Begin -->
    <div class="titlebar">
        <h3>
            Registro de Degustaciones
        </h3>
    </div>
    <div class="block_cont">
        @(Html.Telerik().Grid(Model)
        .Name("DegustacionesGrid")
        .Localizable("es-ES")
        .Filterable()
        .ToolBar(commands => commands.Insert())
                .Editable(editing => editing
                    .Mode(GridEditMode.PopUp)
                    .TemplateName("DegustacionTemplateView"))
                    .HtmlAttributes(new { style = "position: relative, top: 50%, left: 60%, width: 900px" })
        .DataKeys(key => key.Add(c => c.ID))
        .Columns(columns =>
        {
            columns.Bound(c => c.Fecha);
            columns.ForeignKey(c => c.CategoriaID, (System.Collections.IEnumerable)ViewData["Categorias"], "ID", "NombreCategoria").Width(100);
            columns.ForeignKey(c => c.CampanaID, (System.Collections.IEnumerable)ViewData["Campanas"], "ID", "NombreCampana").Width(100);
            columns.ForeignKey(c => c.VendedorID, (System.Collections.IEnumerable)ViewData["Vendedores"], "ID", "NombreLargo").Width(100);
            columns.ForeignKey(c => c.ProductoID, (System.Collections.IEnumerable)ViewData["Productos"], "ID", "Descripcion").Width(160);
            columns.Bound(c => c.Cantidad);
            columns.Bound(c => c.Descripcion);
            //columns.Bound(c => c.Estado)
            //    .ClientTemplate("<input type='checkbox' disabled='disabled' name='Estado' <#= Estado? checked='checked' : '' #> />");
            columns.Command(commands =>
            {
                commands.Delete().ButtonType(GridButtonType.Image);
            }).Title("Opciones"); ;
        })
        .Pageable()
        .Sortable()
        .Scrollable(scrolling => scrolling.Height(250))
        .DataBinding(dataBinding => dataBinding
            .Ajax()
            .Select("Select", "Degustacion")
            .Insert("Insert", "Degustacion")
            .Delete("Delete", "Degustacion")
        )
    )
    </div>
    <!-- Table Wrapper End -->
</div>